import request from '@/utils/request'
import cache from "@/utils/cache";


//发送短信
export function smsSend(mobile: any) {
  return request.get({ url: "/app/appmobile/" + mobile });
}

export function queryTenantList() {
  return request.get({ url: "/admin/tenant/list" });
}

export function getConfig() {
  return request.get({ url: "/admin/index/config" });
}

export function getPolicy(data: any) {
  return request.get({ url: "/app/index/policy", data: data });
}

export function wxJsConfig(data: any) {
  return request.get({ url: "/app/wechat/jsConfig", data });
}

export function doPay(data: any) {
  // return request.post({ url: "/admin/m/order/pay", data: data });
  return request.post({ url: "/admin/biz/pay/buy", data: data });
}

// 获取世界地理位置
export function getWorldAddress(data: object) {
  return request.get({ url: "/admin/common/world-geo", data });
}

/**
 * 获取服务协议
 * @param type  类型：1.用户协议 2.隐私政策 3.服务协议 4.退换货政策 5.退款政策 6.帮助中心(FAQ)
 */
export function getServiceProtocol(type: string) {
  return request.get({
    url: "/admin/common/service-protocol-config",
    data: { type },
  });
}

/**
 * app 更新检查
 */
export const appUpdateAPI = (data: any) => {
  return request.get({
    url: "/admin/m/appVersion/info",
    data: data,
  });
};



export function uploadImage(file: any, token?: string) {
  return request.uploadFile({
    url: "/admin/sys-file/upload",
    filePath: file,
    name: "file",
    header: {
      Authorization: `Bearer ${token}`,
      "TENANT-ID": cache.getTenant(),
    },
    fileType: "image",
  });
}


